﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeFile="List.aspx.cs" Inherits="List" %>
<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
        <DataControls>
            <asp:DataControlReference ControlID="GridView1" />
        </DataControls>
    </asp:DynamicDataManager>

    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("a[jns=lnkInsrt]").focus();
        });
    </script>

    <h2 class="DDSubHeader">Danh sách loại mặt hàng <%--từ bảng <%= table.DisplayName%>--%></h2>
 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
           <div class="DD">
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
                    HeaderText="Vui lòng sửa lại các lỗi dưới đây" CssClass="DDValidator" DisplayMode="BulletList"/>
                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator"/>
                   
                <br /> 
                <div class="DDFilter" style="display:none"> 
                    <asp:HyperLink runat="server" ID="ViewAllLink" Text="Tất cả các loại mặt hàng" />
                </div>  
                <br />
            </div>


           <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
                AllowPaging="True" AllowSorting="True" CssClass="DDGridView" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound"
                RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:HyperLink runat="server" CssClass="thickbox" id="lnkEdt">Sửa</asp:HyperLink>
                            &nbsp;<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" Text="Xóa"
                                OnClientClick='return confirm("Bạn chắc chắn muốn xóa loại mặt hàng nầy?");'
                            />&nbsp;<asp:HyperLink runat="server" id="lnkView">Xem</asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:DynamicField DataField="ProductCategory2" HeaderText="Mã HS cha" NullDisplayText="Không có"/>
                    <asp:DynamicField DataField="ProductCategoryCode" HeaderText="Mã HS"/>
                    <asp:DynamicField DataField="Description" HeaderText="Mô tả" HtmlEncode="false" ReadOnly="true"/>
                    <asp:DynamicField DataField="Products" HeaderText="Danh sách mặt hàng loại nầy"/>
                    <asp:DynamicField DataField="ProductCategory1" HeaderText="Danh sách loại thấp hơn" NullDisplayText="Không có"/>
                </Columns>

                <PagerStyle CssClass="DDFooter"/>        
                <PagerTemplate>
                    <asp:GridViewPager ID="GridViewPager1" runat="server" />
                </PagerTemplate>
                <EmptyDataTemplate>
                    Chưa có dữ liệu.
                </EmptyDataTemplate>
            </asp:GridView>

            <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" />
            
            <asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server">
                 <asp:DynamicRouteExpression ColumnName="ParentProductCategoryID" />
            </asp:QueryExtender>

            <br />

            <div class="DDBottomHyperLink">
                <asp:DynamicHyperLink ID="ListHyperLink" runat="server" Action="List" Visible="false">Quay lại</asp:DynamicHyperLink>
                <a runat="server" id="lnkInsrt" jns="lnkInsrt" href="#" class="thickbox"><img alt="" src="<%= Page.ResolveUrl("~")%>Images/plus.gif"/>Thêm mới</a>
            </div>



        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

